/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EL;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Tian
 */
@Entity
@Table(name = "ReservationDetails")
@NamedQueries(
{
    @NamedQuery(name = "ReservationDetails.findAll", query = "SELECT r FROM ReservationDetails r")
})
public class ReservationDetails implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ReservationDetailsPK reservationDetailsPK;
    @Column(name = "arrivedDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date arrivedDate;
    @Column(name = "quantity")
    private Integer quantity;
    @JoinColumn(name = "tableID", referencedColumnName = "id", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private RestaurantTables restaurantTables;
    @JoinColumn(name = "reservationID", referencedColumnName = "id", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Reservations reservations;

    public ReservationDetails()
    {
    }

    public ReservationDetails(ReservationDetailsPK reservationDetailsPK)
    {
        this.reservationDetailsPK = reservationDetailsPK;
    }

    public ReservationDetails(Integer quantity)
    {
        this.quantity = quantity;
    }

    public Date getArrivedDate()
    {
        return arrivedDate;
    }

    public void setArrivedDate(Date arrivedDate)
    {
        this.arrivedDate = arrivedDate;
    }

    public ReservationDetailsPK getReservationDetailsPK()
    {
        return reservationDetailsPK;
    }

    public void setReservationDetailsPK(ReservationDetailsPK reservationDetailsPK)
    {
        this.reservationDetailsPK = reservationDetailsPK;
    }

    public Date getCheckInDate()
    {
        return arrivedDate;
    }

    public void setCheckInDate(Date arrivedDate)
    {
        this.arrivedDate = arrivedDate;
    }


    public Integer getQuantity()
    {
        return quantity;
    }

    public void setQuantity(Integer quantity)
    {
        this.quantity = quantity;
    }

    public RestaurantTables getRestaurantTables()
    {
        return restaurantTables;
    }

    public void setRestaurantTables(RestaurantTables restaurantTables)
    {
        this.restaurantTables = restaurantTables;
    }

    public Reservations getReservations()
    {
        return reservations;
    }

    public void setReservations(Reservations reservations)
    {
        this.reservations = reservations;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (reservationDetailsPK != null ? reservationDetailsPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ReservationDetails))
        {
            return false;
        }
        ReservationDetails other = (ReservationDetails) object;
        if ((this.reservationDetailsPK == null && other.reservationDetailsPK != null) || (this.reservationDetailsPK != null && !this.reservationDetailsPK.equals(other.reservationDetailsPK)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "EL.ReservationDetails[reservationDetailsPK=" + reservationDetailsPK + "]";
    }

}
